package socks

import (
	"sync/atomic"
	"time"
)

type FastLocker struct {
	i int32
}

func (l *FastLocker) Lock() {
	for {
		if atomic.SwapInt32(&l.i, 1) == 1 {
			time.Sleep(time.Nanosecond)
		} else {
			break
		}
	}
}

func (l *FastLocker) Unlock() {
	l.i = 0
}
